package com.sky.mapper;

import com.sky.annotation.AutoFill;
import com.sky.entity.Dish;
import com.sky.entity.SetmealDish;
import com.sky.enumeration.OperationType;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetmealDishMapper {

    void addSetmeal(List<SetmealDish> setmealDishes);

    /**
     * 根据菜品id集合查询套餐是否关联
     * @param dishIds
     * @return 返回大于0表示有关联
     */
    List<Long> getSetmealIdsByDishIds(List<Long> dishIds);

    /**
     * 根据菜品id删除菜品套餐关联表
     * @param id  setmeal_id
     */
    @Delete("delete from setmeal_dish where setmeal_id = #{id}")
    void deleteSetmealDishID(Long id);

    /**
     * 根据id查询菜品
     * @param id
     * @return
     */
    @Select("select * from setmeal_dish where setmeal_id=#{id}")
    List<SetmealDish> getDishBySetmealId(Long id);
}
